﻿
@section css{
    <link href="~/Wap/address.css" rel="stylesheet">
}

@section scripts{
    <script id="each" type="text/x-jquery-tmpl">
        <div id="ShadeFromDiv" class="shade_content_div">
            {{if status}}
            <div class="shade_from">
                <div>
                    <span>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区</span>
                    <input class="input_style" type="text" name="region" id="region" value="123">
                </div>
                <div>
                    <span>详细地址</span>
                    <input class="input_style" type="text" name="address" id="address" value="abc">
                </div>
                <div>
                    <span>邮政编号</span>
                    <input class="input_style" type="text" name="number_this" id="number_this" value="222">
                </div>
                <div>
                    <span>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</span>
                    <input class="input_style" type="text" name="name_this" id="name_this" value="333">
                </div>
                <div>
                    <span>手机号码</span>
                    <input class="input_style" type="text" name="phone" id="phone" value="111">
                </div>
            </div>
            {{/if}}
        </div>
    </script>
    <script type="text/javascript">
        var bootstrap = function ($, ibpm) {
            "use strict";
            var page = {
                init: function () {
                    //初始化
                    page.bind();
                },
                bind: function () {
                    $(".address-list > li > p").click(function (e) {
                        $(this).parent().addClass("curr").siblings().removeClass("curr");
                        setTimeout(function () {
                            if (sessionStorage.url == 'confirm')
                                history.back();
                        }, 500);
                    });
                    $(".deleteButton").click(function (e) {
                        var self = this;
                        e.preventDefault();
                        layer.open({
                            content: '确定删除此收货地址？',
                            btn: ['确定', '不要'],
                            yes: function (index) {
                                console.log(index);
                                $(self).parent().parent().remove();
                                layer.closeAll();
                            }
                        });
                    });
                    $(".editButton").click(function (e) {
                        e.preventDefault();
                        var eachData = {
                            status: 1
                        };
                        var parentdiv = $('<div></div>');
                        $("#each").tmpl(eachData).appendTo(parentdiv);
                        layer.open({
                            title: [
                                '修改收货地址',
                                'background-color:#03A9F4; color:#fff;'
                            ],
                            anim: 'up',
                            content: parentdiv.html(),
                            btn: ['确认', '取消'],
                            yes: function (index) {
                                var postData = $('#ShadeFromDiv').ibpm_GetFormData();
                                alert(JSON.stringify(postData));
                                //layer.closeAll();
                                layer.close(index);
                            }
                        });
                    });
                }
            };
            page.init();
        };
    </script>
}

<div class="warp clearfloat">
    <ul class="address-list">
        <li>
            <p>收货人：小王&nbsp;&nbsp;182********</p>
            <p>收货地址：湖南省长沙市高新区拓基城市广场金座A2002</p>
            <hr />
            <div class="address-cz">
                <label class="am-radio am-warning">
                    <input type="radio" name="radio3" value="" data-am-ucheck checked> 设为默认
                </label>
                <a href="" class="editButton"><img src="/Playground/images/bj.png" width="18" />&nbsp;编辑</a>
                <a href="" class="deleteButton">删除</a>
            </div>
        </li>
        <li class="curr">
            <p>收货人：小王&nbsp;&nbsp;182********</p>
            <p>收货地址：湖南省长沙市高新区拓基城市广场金座A2002</p>
            <hr />
            <div class="address-cz">
                <label class="am-radio am-warning">
                    <input type="radio" name="radio3" value="" data-am-ucheck> 设为默认
                </label>
                <a href="" class="editButton"><img src="/Playground/images/bj.png" width="18" />&nbsp;编辑</a>
                <a href="" class="deleteButton">删除</a>
            </div>
        </li>
        <li>
            <p>收货人：小王&nbsp;&nbsp;182********</p>
            <p>收货地址：湖南省长沙市高新区拓基城市广场金座A2002</p>
            <hr />
            <div class="address-cz">
                <label class="am-radio am-warning">
                    <input type="radio" name="radio3" value="" data-am-ucheck> 设为默认
                </label>
                <a href="" class="editButton"><img src="/Playground/images/bj.png" width="18" />&nbsp;编辑</a>
                <a href="" class="deleteButton">删除</a>
            </div>
        </li>
        <li>
            <p>收货人：小王&nbsp;&nbsp;182********</p>
            <p>收货地址：湖南省长沙市高新区拓基城市广场金座A2002</p>
            <hr />
            <div class="address-cz">
                <label class="am-radio am-warning">
                    <input type="radio" name="radio3" value="" data-am-ucheck> 设为默认
                </label>
                <a href="" class="editButton"><img src="/Playground/images/bj.png" width="18" />&nbsp;编辑</a>
                <a href="" class="deleteButton">删除</a>
            </div>
        </li>
    </ul>
</div>
